/**********************************************************************************************************************************

"Foreign Aid and State Legitimacy: Evidence on Chinese and US Aid to Africa from Surveys, Survey Experiments, and Behavioral Games"
Robert A. Blair and Philip Roessler
World Politics
Replication Files

**********************************************************************************************************************************/

			
			
		clear
		set more off, perm

	
	
	// Set directory
					
		cd "[YOUR DIRECTORY]"

		
	
	// Load data
	
		use "games_urban_data", clear
					


	// Define globals

		gl i_ctrls female age educ_abc educ_jh educ_hs employed rel_Muslim


	
xxx

			

	// Replicate figure 1

		reg hid_real_total_pct i.treatment audit_real_total $i_ctrls
			margins, atmeans at(treatment=(1(1)4)) level(95) post
				graph set window fontface "Times"
				marginsplot, recast(scatter) graphr(color(white)) plotopts(mcolor(black) msymbol(square)) ciopts(lcolor(black) lpattern(solid)) ///
					title("Urban games sample", color(black) position(1)) ///
					xtitle("Treatment group", margin(medium)) xlabel(, angle(horizontal)) xscale(range(0.5(1)4.5)) ///
					ytitle("% of income hidden in tax compliance game", margin(medsmall) size(medium)) ylabel(0(.2)1) ///
					xsize(4.4) ysize(3.26)
					gr_edit .xaxis1.edit_tick 5 1 `"(N = 181)"', tickset(major) editstyle(tickstyle(textgap(4.6944)) )
					gr_edit .xaxis1.edit_tick 6 2 `"(N = 182)"', tickset(major) editstyle(tickstyle(textgap(4.6944)) )
					gr_edit .xaxis1.edit_tick 7 3 `"(N = 179)"', tickset(major) editstyle(tickstyle(textgap(4.6944)) )
					gr_edit .xaxis1.edit_tick 8 4 `"(N = 180)"', tickset(major) editstyle(tickstyle(textgap(4.6944)) )
					graph export "figure1.png", as(png) replace			



	// Replicate table A6
													
		mlogit treatment $i_ctrls
			margins, dydx(*) predict(outcome(Control)) post
				outreg2 using "tableA6.tex", tex aster(se) dec(2) br nocons keep($i_ctrls) ctitle(Control) label replace
		mlogit treatment $i_ctrls
			margins, dydx(*) predict(outcome(Government)) post
				outreg2 using "tableA6.tex", tex aster(se) dec(2) br nocons keep($i_ctrls) ctitle(Government) label append
		mlogit treatment $i_ctrls
			margins, dydx(*) predict(outcome(China)) post
				outreg2 using "tableA6.tex", tex aster(se) dec(2) br nocons keep($i_ctrls) ctitle(China) label append
		mlogit treatment $i_ctrls
			margins, dydx(*) predict(outcome(USA)) post
				outreg2 using "tableA6.tex", tex aster(se) dec(2) br nocons keep($i_ctrls) ctitle(USA) label append
				
